<?php wpm2_xhtml_headers(); ?>
<title><?php wp_title( '-', true, 'right' ); echo wp_specialchars( get_bloginfo('name'), 1 ); ?></title>
<meta name="HandheldFriendly" content="true" />
<meta name="MobileOptimized" content="width" />
<link rel="stylesheet" type="text/css" charset="<?php bloginfo('charset'); ?>" href="<?php bloginfo('stylesheet_directory'); ?>/m.css" />
<link rel="alternate" type="application/rss+xml" charset="<?php bloginfo('charset'); ?>" href="<?php bloginfo('rss2_url'); ?>" title="<?php echo wp_specialchars( get_bloginfo('name'), 1 ); ?> Feed" />
</head>
<body class="<?php wpm2_body_class(); ?>">
<h1 id="title"><?php bloginfo('name'); ?></h1>
<hr />
<p><a accesskey="1" href="<?php bloginfo('home'); ?>/" title="<?php echo wp_specialchars( get_bloginfo('name'), 1 ) ?>" rel="home">Home</a> | <a accesskey="2" href="#pages" title="Skip to list of pages">Pages</a> | <a accesskey="3" href="#searchform" title="Skip to search">Search</a></p>
<hr />
<?php $postcount = 1; if ( have_posts() ) : ?>
<?php if ( is_category() ) { ?>
<h2>Category archives: <?php single_cat_title(); ?></h2>
<?php } elseif ( is_tag() ) { ?>
<h2>Tag archives: <?php single_tag_title(); ?></h2>
<?php } elseif ( is_search() ) { ?>
<h2>Search results: <?php the_search_query(); ?></h2>
<?php } elseif ( is_month() ) { ?>
<h2>Archive: <?php the_time('F, Y'); ?></h2>
<?php } elseif ( is_paged() ) { ?>
<h2>Blog archives</h2>
<?php } ?>
<?php while ( have_posts() ) : the_post(); ?>
<?php if ( $wp_query->is_page && !is_home() ) $parent = $post->ID; ?>
<?php if ( is_home() ) { ?>
<div>
<a href="<?php the_permalink() ?>" title="Permalink to <?php the_title_attribute(); ?>" rel="bookmark"><?php the_title(); ?></a> <?php the_time('F j, Y'); ?>
<?php if ( !is_paged() && $postcount == 1 ) { ?> <p class="entry-summary"><?php the_content_rss( '', TRUE, '', 40, 2 ); ?></p><?php } ?>
</div>
<?php } elseif ( is_single() ) { ?>
<h2><?php the_title(); ?></h2>
<p><?php the_time('F j, Y, g:i a'); ?> by <?php the_author(); ?> <?php edit_post_link( 'Edit', '', '' ); ?></p>
<div class="entry-content">
<?php the_content(); ?>
</div>
<p>Posted in <?php the_category(', '); ?></p>
<?php echo get_the_tag_list( '<p>Tags: ',', ','</p>' ); ?>
<?php comments_template(); ?>
<?php } elseif ( is_page() ) { ?>
<h2><?php the_title(); ?></h2>
<div class="entry-content">
<?php the_content(); ?>
</div>
<?php comments_template(); ?>
<?php } else { ?>
<div><a href="<?php the_permalink() ?>" title="Permalink to <?php the_title_attribute(); ?>" rel="bookmark"><?php the_title(); ?></a> <?php the_time('F j, Y'); ?></div>
<?php } ?>
<?php $postcount++; endwhile; ?>
<?php if ( is_home() || is_archive() || is_search() ) { ?>
<?php if ( wpm2_show_navigation() ) { ?>
<p><?php posts_nav_link( ' | ', 'Newer', 'Older' ); ?></p>
<?php } ?>
<?php } elseif ( is_single() ) { ?>
<p><?php previous_post_link( '%link', 'Previous' ); ?> | <?php next_post_link( '%link', 'Next' ); ?></p>
<?php } ?>
<?php else : ?>
<h2>Not Found</h2>
<div class="entry-content">
<p>Apologies. What you're looking for doesn't seem to be here.</p>
</div>
<?php endif; ?>
<hr />
<?php 
	if ( wp_list_pages('title_li=&depth=1&child_of=' . $parent . '&echo=0') != null ) {
?>
<h2 id="pages"><?php if ( $parent != null ) echo 'Subpages'; else echo 'Pages'; ?></h2>
<ul>
<?php wp_list_pages('title_li=&depth=1&child_of=' . $parent); ?>
</ul>
<?php
	} else {
?>
<h2 id="pages">Pages</h2>
<ul>
<?php wp_list_pages('title_li=&depth=1'); ?>
</ul>
<?php
	}
?>
<hr />
<form id="searchform" method="get" action="<?php bloginfo('home') ?>"><div><label for="s">Search for:</label><input type="text" value="<?php the_search_query() ?>" id="s" name="s" /><input type="submit" value="Search" /></div></form>
<hr />
<p>Mobile Site | <a href="<?php bloginfo('wpurl'); ?>/wp-admin/options-general.php?ak_action=reject_mobile" title="Exit mobile site to full site">Full Site</a></p>
</body>
</html>